-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathassets.sql
More file actions
32 lines (29 loc) · 1.95 KB
/
Copy pathassets.sql
File metadata and controls
32 lines (29 loc) · 1.95 KB
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
28
29
30
31
32
DROP TABLE IF EXISTS assets;
CREATE TABLE assets (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
asset_id VARCHAR(40) NOT NULL, -- asset_id (encoded asset name)
asset VARCHAR(40) NOT NULL, -- asset name
asset_longname VARCHAR(255), -- subasset name
block_index INTEGER UNSIGNED, -- block that asset was created
description VARCHAR(10000), -- store up to 10k characters
description_locked TINYINT(1) default 0,
divisible TINYINT(1),
owner_id INTEGER UNSIGNED, -- id of record in index_addresses
issuer_id INTEGER UNSIGNED, -- id of record in index_addresses
locked TINYINT(1) default 0,
supply BIGINT UNSIGNED,
type TINYINT(1), -- asset type (1=Named, 2=Numeric, 3=Subasset, 4=Failed issuance)
xcp_price BIGINT UNSIGNED, -- last price of XCP matched order on DEX
xcp_price_block INTEGER UNSIGNED, -- block_index that xcp_price was set from
btc_price BIGINT UNSIGNED, -- last price of BTC matched order on DEX or Dispense
btc_price_block INTEGER UNSIGNED -- block_index that btc_price was set from
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO assets (asset_id, asset, divisible, locked) values (0,'BTC', 1, 1);
INSERT INTO assets (asset_id, asset, divisible, locked, xcp_price) values (1,'XCP', 1, 1, 100000000);
CREATE UNIQUE INDEX asset ON assets (asset);
CREATE INDEX issuer_id ON assets (issuer_id);
CREATE INDEX owner_id ON assets (owner_id);
CREATE INDEX asset_longname ON assets (asset_longname);
-- ALTER TABLE assets ADD btc_price BIGINT UNSIGNED AFTER xcp_price;
-- ALTER TABLE assets MODIFY description VARCHAR(10000);
-- ALTER TABLE assets ADD xcp_price_block INTEGER UNSIGNED AFTER xcp_price, ADD btc_price_block INTEGER UNSIGNED AFTER btc_price;