pkgsite/devtools/create_migration.sh

20 строки
572 B
Bash
Executable File

#!/usr/bin/env -S bash -e
# Copyright 2019 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Script for creating a new migration file.
migrate create -ext sql -dir migrations -seq $1
HEADER="-- Copyright 2020 The Go Authors. All rights reserved.
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE file.
BEGIN;
-- Write your migration here.
END;"
for f in $(ls migrations | tail -n 2); do echo "$HEADER" >> "migrations/$f"; done