Class: OrdDb::CreateDb
- Inherits:
-
Object
- Object
- OrdDb::CreateDb
- Defined in:
- lib/ordlite/schema.rb
Instance Method Summary collapse
Instance Method Details
#up ⇒ Object
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/ordlite/schema.rb', line 7 def up ActiveRecord::Schema.define do =begin CREATE TABLE inscribes( id varchar NOT NULL PRIMARY KEY, num integer NOT NULL, content_length integer NOT NULL, content_type varchar NOT NULL, date datetime(6) NOT NULL, sat integer NOT NULL, height integer NOT NULL, fee integer NOT NULL, tx varchar NOT NULL, offset integer NOT NULL, address varchar NOT NULL, created_at datetime(6) NOT NULL, updated_at datetime(6) NOT NULL) CREATE TABLE blobs( id varchar NOT NULL PRIMARY KEY, content blob NOT NULL created_at datetime(6) NOT NULL, updated_at datetime(6) NOT NULL) =end create_table :inscribes, :id => :string do |t| ## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0", ## note: change to uuid (universally unique id) - why? why not? ## id gets used by row_id (internal orm db machinery) and is int ## t.string :uuid, null: false, index: { unique: true, name: 'inscribe_uuids' } ## "title": "Inscription 10371414", ## note: use num/no. from title only - why? why not? t.integer :num, null: false, index: { unique: true, name: 'inscribe_nums' } ## "content length": "85 bytes", ## note: extract bytes as integer!!! ## change to bytes - why? why not? t.integer :bytes, null: false ## "content type": "text/plain;charset=utf-8", ## note: make sure always lower/down case!!! t.string :content_type, null: false ## "timestamp": "2023-06-01 05:00:57 UTC" ## or use date_utc ??? t.datetime :date, null: false ## ## "sat": "967502783701719", t.integer :sat, null: false ## ## "genesis height": "792337", ## -> change height to block - why? why not? ## "genesis fee": "6118", ## "genesis transaction": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5c", ## "offset": "0" t.integer :block, null: false t.integer :fee, null: false t.string :tx, null: false t.integer :offset, null: false ### ## "address": "bc1p3h4eecuxjj2g72sq38gyva732866u5w29lhxgeqfe6c0sg8xmagsuau63k", ## is this minter/inscriber addr??? t.string :address, null: false ## "output": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5c:0", ## "output value": "546", t.string :output, null: false t.integer :value, null: false ## -- ignore for now - why? why not? ## what is location ??? ## "location": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5c:0:0", ## timestamp last t. end create_table :blobs, :id => :string do |t| ## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0", ## note: change to uuid (universally unique id) - why? why not? ## id gets used by row_id (internal orm db machinery) and is int ## t.string :id, null: false, index: { unique: true, name: 'blob_uuids' } t.binary :content, null: false t.string :sha256 ## sha256 hash t.string :md5 ## md5 hash - add why? why not? ## timestamp last t. end =begin "name": "Planetary Ordinals", "inscription_icon": "98da33abe2045ec1421fcf1bc376dea5beb17ded15aa70ca5da490f50d95a6d9i0", "supply": "69", "slug": "planetary-ordinals", "description": "", "twitter_link": "https://twitter.com/ordinalswallet", "discord_link": "https://discord.com/invite/ordinalswallet", "website_link": "" =end create_table :collections do |t| t.string :name, null: false t.string :slug t.text :desc # description t.integer :max # supply t.string :icon_id ## rename to inscribe_icon_id or such - why? why not? ## add twitter_link, discord_link, website_link - why? why not? ## if on-chain and metadata inscribed - add why? why not?? ## t.string :source_id, null: false ## foreign key reference ## timestamp last t. end create_table :items do |t| t.integer :collection_id, null: false t.string :inscribe_id, null: false t.integer :pos, null: false t.string :name ## timestamp last t. ## todo/fix: add unique index for :pos+:collection_id !!! end ### # generative (collection) factory create_table :factories, :id => :string do |t| t.string :name t.integer :max # max limit t.integer :maxblock # max block limit t.string :dim # dimension e.g. 24x24 (in px) t.string :inscribe_id, null: false ## foreign key reference ## timestamp last t. end ##### ## join table (factory has_many modules) ## rename to layer / sprites / blocks / tiles / modules / submodules / subs / mods / ...etc - why? why not? ## layerlists or inscribelists or ??? ## change/rename to factory_items or layer_items or such? create_table :inscriberefs, :id => false do |t| t.string :factory_id, null: false t.string :inscribe_id, null: false t.integer :pos, null: false ## position (index) in list (starting at 0) ## todo/fix: make factory_id + inscribe_id + pos unique index - why? why not? ## timestamp last t. end create_table :generatives, :id => :string do |t| t.string :factory_id, null: false t.string :g, null: false ## use space separated numbers - why? why not? t.binary :content ### optional for now - why? why not? ## timestamp last t. end end # block Schema.define end |