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 |
# 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 at 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 ## timestamp at last t. end end # block Schema.define end |