- Open
migrations/20211019221200_init_db.sql
- Add your new table schema in the file, between the
-- +goose Up \n -- +goose StatementBegin
and-- +goose StatementEnd
lines Example:
CREATE TABLE IF NOT EXISTS <your_new_table> (
id BIGSERIAL NOT NULL,
/*
... Some fields
*/
createdat DATE,
updatedat DATE
);
- Add a drop table statement
-- +goose Down \n -- +goose StatementBegin
and-- +goose StatementEnd
lines Example:
DROP TABLE IF EXISTS <your_new_table>;
-
Create a fixture file
<your_new_table>.sql
for that will be used to populate your table in this location. Note: You can use mockaroo to generate the fixture data. -
Add the
../../fixtures/postgres/sql/<your_new_table>.sql
in the appropriate position on thatsql_file_ordered.txt
file. This is used to specify the order in which your sql fixtures files will be applied to the Database.