github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/workload/ledger/ddls.go (about) 1 // Copyright 2018 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package ledger 12 13 const ( 14 ledgerCustomerSchema = `( 15 id INT NOT NULL PRIMARY KEY DEFAULT unique_rowid(), 16 identifier STRING(255) NOT NULL, 17 "name" STRING(255) NULL, 18 currency_code STRING(3) NOT NULL, 19 is_system_customer BOOL NOT NULL, 20 is_active BOOL NOT NULL, 21 created TIMESTAMP NOT NULL DEFAULT clock_timestamp(), 22 balance DECIMAL(20,3) NOT NULL DEFAULT 0:::DECIMAL, 23 credit_limit DECIMAL(20,3) NULL, 24 sequence_number INT NULL DEFAULT (-1):::INT, 25 26 INDEX customer_identifier_active_idx (identifier ASC, is_active ASC), 27 UNIQUE INDEX customer_ide_cur_ia_idx (identifier ASC, currency_code ASC, is_active ASC) 28 )` 29 ledgerTransactionSchema = `( 30 external_id STRING(255) NOT NULL PRIMARY KEY, 31 tcomment STRING(255) NULL, 32 context STRING(255) NULL, 33 transaction_type_reference INT NOT NULL, 34 username STRING(255) NULL, 35 created_ts TIMESTAMP NOT NULL, 36 systimestamp TIMESTAMP NOT NULL DEFAULT clock_timestamp(), 37 reversed_by STRING(255) NULL, 38 response BYTES NULL 39 )` 40 ledgerEntrySchema = `( 41 id INT NOT NULL PRIMARY KEY DEFAULT unique_rowid(), 42 amount DECIMAL(20,3) NULL, 43 customer_id INT NULL, 44 transaction_id STRING(255) NOT NULL, 45 system_amount DECIMAL(24,7) NULL, 46 created_ts TIMESTAMP NOT NULL, 47 money_type STRING(1) NOT NULL 48 )` 49 ledgerSessionSchema = `( 50 session_id STRING NOT NULL PRIMARY KEY, 51 expiry_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, 52 data STRING NOT NULL, 53 last_update TIMESTAMP NOT NULL 54 )` 55 )