github.com/wawandco/oxplugins@v0.7.11/tools/liquibase/tables.go (about) 1 package liquibase 2 3 import ( 4 "context" 5 6 "github.com/jackc/pgx/v4" 7 ) 8 9 // CreateInstruction for the database tables that should be in the 10 // database. 11 var createInstruction = ` 12 CREATE TABLE IF NOT EXISTS public.databasechangelog ( 13 id character varying(255) not null, 14 author character varying(255) not null, 15 filename character varying(255) not null, 16 dateexecuted timestamp without time zone not null, 17 orderexecuted integer not null, 18 exectype character varying(10) not null, 19 md5sum character varying(35), 20 description character varying(255), 21 comments character varying(255), 22 tag character varying(255), 23 liquibase character varying(20), 24 contexts character varying(255), 25 labels character varying(255), 26 deployment_id character varying(10) 27 ); 28 29 CREATE TABLE IF NOT EXISTS public.databasechangeloglock ( 30 id integer not null, 31 locked boolean not null, 32 lockgranted timestamp without time zone, 33 lockedby character varying(255) 34 ); 35 ` 36 37 // EnsureTables are in the database. 38 func (lb Command) EnsureTables(conn *pgx.Conn) error { 39 err := conn.Ping(context.Background()) 40 if err != nil { 41 return err 42 } 43 44 _, err = conn.Exec(context.Background(), createInstruction) 45 46 return err 47 }