-
Notifications
You must be signed in to change notification settings - Fork 1
/
database.gradle
27 lines (25 loc) · 1.21 KB
/
database.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
flyway {
url = "$System.env.DATABASE_URL"
user = "$System.env.POSTGRES_USER"
password = "$System.env.POSTGRES_PASSWORD"
schemas = ['reports']
sqlMigrationPrefix = ''
placeholderPrefix = '#['
placeholderSuffix = ']'
}
// Usage: gradle generateMigration [-PmigrationName=name_of_migration]
// Defaults to 'migration' as migration name
// Example: gradle generateMigration -PmigrationName=add_column_to_users
// Will create a file in migration folder with name yyyyMMddHHmmssSSS_add_column_to_users.sql.
task generateMigration << {
description 'Creates an empty new file within the src/main/resources/db/migration directory into which developers can add new SQL migration code.'
def fileName = project.hasProperty('migrationName') ? migrationName : 'migration'
def timestamp = new Date().format('yyyyMMddHHmmssSSS', TimeZone.getTimeZone('GMT'))
def fullFileName = "${timestamp}__${fileName}.sql"
def migrationFile = new File(sourceSets.main.resources.srcDirs.first(),'db/migration/'+fullFileName)
migrationFile.createNewFile()
}
task demoDataSeed(type:Exec) {
executable "./demo-data/demo_seed.sh"
args "demo-data", "build/demo-data", "demo-data/generator.js"
}