// Match table creation // use CreateMigration.stub template for table creation // use blank.stub template for others reg := regexp.MustCompile(`^create_(\w+)_table$`)
if lastBatch == 0 { // No migration record in database, all migrations should to be Migrate toMigrate = fSlices } else { // Get migrated files' name for rows.Next() { m, err = scanRow(rows) if err != nil { return err }
dbMigrate = append(dbMigrate, m.Migration) }
// Compare and get which migration not migrated yet for _, v := range fSlices { if !sliceContain(dbMigrate, v) { toMigrate = append(toMigrate, v) } } }
// Nothing to Migrate, stop and log fatal toMigrateLen := len(toMigrate) if toMigrateLen == 0 { color.Blue("Nothing migrated") os.Exit(2) }
// Migrate for i, v := range toMigrate {
// Read up.sql upSql, err = ioutil.ReadFile(migrationPath + v + "/up.sql") if err != nil { return err }
if i, err := strconv.Atoi(step); err == nil { if lastBatch >= i { toBatch = lastBatch - (i - 1) } else { color.Red("Can not Rollback %d steps", i) return err } }
// Which migrations need to be Rollback rows, err = db.Query("SELECT * FROM migrations WHERE `batch`>=" + strconv.Itoa(toBatch)) if err != nil { return err }
// Rollback slice for rows.Next() { m, err = scanRow(rows) if err != nil { return err }
rollBackMig = append(rollBackMig, m.Migration) }
// Rolling back for _, v := range rollBackMig {
downSql, err = ioutil.ReadFile(migrationPath + v + "/down.sql") if err != nil { return err }
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/example.com/privkey.pem Your cert will expire on 2019-02-13. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com ) # 使用 gitlab.com 的朋友,直接填写 https://gitlab.com; # 如果是部署私有云的朋友请填写自己的 gitlab 服务器,如果是内容,还需要在路由器做端口转发
Please enter the gitlab-ci token for this runner # 打开并登录 gitlab.com,点击左菜单的 settings > CI/CD > Runners, # 在 Specific Runners 下面,找到 token,并复制粘贴到 ternimal。
Please enter the gitlab-ci tags for this runner (comma separated): # 这里填入标签,gitlab-runner 是根据标签来区分的,这里可以按照自己的需求, # 来确定填入标签的形式,例如可以按照项目来区分,如:fz-oa,这样, # 在 .gitlab-ci.yml 里面,deploy 阶段的 tags,也需要填入 fz-oa 来匹配 # 对应的 gitlab-runner
#!/bin/bash if [ $# -ne 2 ] then echo"arguments error!" exit 1 else deploy_path="/var/www/$1/$2" if [ ! -d "$deploy_path" ] then project_path="git@gitlab.com:"$1/$2".git" git clone$project_path$deploy_path else cd$deploy_path git pull fi fi