2020-01-23 21:53:00 +00:00
|
|
|
#!/bin/sh
|
2020-01-17 20:07:00 +00:00
|
|
|
|
|
|
|
dbx schema -d postgres -d cockroach satellitedb.dbx .
|
|
|
|
dbx golang -d postgres -d cockroach -p dbx -t templates satellitedb.dbx .
|
2020-01-23 21:53:00 +00:00
|
|
|
( echo '//lint:file-ignore * generated file'; cat satellitedb.dbx.go ) > satellitedb.dbx.go.tmp && mv satellitedb.dbx.go.tmp satellitedb.dbx.go
|
2020-01-17 20:07:00 +00:00
|
|
|
gofmt -r "*sql.Tx -> tagsql.Tx" -w satellitedb.dbx.go
|
|
|
|
perl -0777 -pi \
|
|
|
|
-e 's,\t"github.com/lib/pq"\n\),\t"github.com/lib/pq"\n\n\t"storj.io/storj/private/tagsql"\n\),' \
|
|
|
|
satellitedb.dbx.go
|
|
|
|
perl -0777 -pi \
|
|
|
|
-e 's/type DB struct \{\n\t\*sql\.DB/type DB struct \{\n\ttagsql.DB/' \
|
|
|
|
satellitedb.dbx.go
|
|
|
|
perl -0777 -pi \
|
|
|
|
-e 's/\tdb = &DB\{\n\t\tDB: sql_db,/\tdb = &DB\{\n\t\tDB: tagsql.Wrap\(sql_db\),/' \
|
2020-01-23 21:53:00 +00:00
|
|
|
satellitedb.dbx.go
|