mirror of
https://github.com/alexgo-io/stacks-blockchain-api.git
synced 2026-01-12 08:34:40 +08:00
37 lines
731 B
JavaScript
37 lines
731 B
JavaScript
/** @param { import("node-pg-migrate").MigrationBuilder } pgm */
|
|
exports.up = pgm => {
|
|
pgm.createTable('zonefiles', {
|
|
id: {
|
|
type: 'serial',
|
|
primaryKey: true,
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
notNull: true,
|
|
},
|
|
zonefile: {
|
|
type: 'string',
|
|
notNull: true,
|
|
},
|
|
zonefile_hash: {
|
|
type: 'string',
|
|
notNull: true,
|
|
},
|
|
tx_id: {
|
|
type: 'bytea',
|
|
notNull: false,
|
|
},
|
|
index_block_hash: {
|
|
type: 'bytea',
|
|
notNull: false,
|
|
}
|
|
});
|
|
|
|
pgm.addIndex('zonefiles', 'zonefile_hash');
|
|
pgm.addConstraint(
|
|
'zonefiles',
|
|
'unique_name_zonefile_hash_tx_id_index_block_hash',
|
|
'UNIQUE(name, zonefile_hash, tx_id, index_block_hash)'
|
|
);
|
|
}
|