storj/satellite/satellitedb/dbx/satellitedb.dbx.sqlite3.sql

315 lines
9.4 KiB
MySQL
Raw Normal View History

-- AUTOGENERATED BY gopkg.in/spacemonkeygo/dbx.v1
-- DO NOT EDIT
CREATE TABLE accounting_rollups (
id INTEGER NOT NULL,
node_id BLOB NOT NULL,
start_time TIMESTAMP NOT NULL,
put_total INTEGER NOT NULL,
get_total INTEGER NOT NULL,
get_audit_total INTEGER NOT NULL,
get_repair_total INTEGER NOT NULL,
put_repair_total INTEGER NOT NULL,
at_rest_total REAL NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE accounting_timestamps (
name TEXT NOT NULL,
value TIMESTAMP NOT NULL,
PRIMARY KEY ( name )
);
CREATE TABLE bucket_bandwidth_rollups (
bucket_name BLOB NOT NULL,
project_id BLOB NOT NULL,
interval_start TIMESTAMP NOT NULL,
interval_seconds INTEGER NOT NULL,
action INTEGER NOT NULL,
inline INTEGER NOT NULL,
allocated INTEGER NOT NULL,
settled INTEGER NOT NULL,
PRIMARY KEY ( bucket_name, project_id, interval_start, action )
);
CREATE TABLE bucket_storage_tallies (
bucket_name BLOB NOT NULL,
project_id BLOB NOT NULL,
interval_start TIMESTAMP NOT NULL,
inline INTEGER NOT NULL,
remote INTEGER NOT NULL,
remote_segments_count INTEGER NOT NULL,
inline_segments_count INTEGER NOT NULL,
object_count INTEGER NOT NULL,
metadata_size INTEGER NOT NULL,
PRIMARY KEY ( bucket_name, project_id, interval_start )
);
CREATE TABLE bucket_usages (
id BLOB NOT NULL,
bucket_id BLOB NOT NULL,
rollup_end_time TIMESTAMP NOT NULL,
remote_stored_data INTEGER NOT NULL,
inline_stored_data INTEGER NOT NULL,
remote_segments INTEGER NOT NULL,
inline_segments INTEGER NOT NULL,
objects INTEGER NOT NULL,
metadata_size INTEGER NOT NULL,
repair_egress INTEGER NOT NULL,
get_egress INTEGER NOT NULL,
audit_egress INTEGER NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE graceful_exit_progress (
node_id BLOB NOT NULL,
bytes_transferred INTEGER NOT NULL,
pieces_transferred INTEGER NOT NULL,
pieces_failed INTEGER NOT NULL,
updated_at TIMESTAMP NOT NULL,
PRIMARY KEY ( node_id )
);
CREATE TABLE graceful_exit_transfer_queue (
node_id BLOB NOT NULL,
path BLOB NOT NULL,
piece_num INTEGER NOT NULL,
durability_ratio REAL NOT NULL,
queued_at TIMESTAMP NOT NULL,
requested_at TIMESTAMP,
last_failed_at TIMESTAMP,
last_failed_code INTEGER,
failed_count INTEGER,
finished_at TIMESTAMP,
PRIMARY KEY ( node_id, path )
);
CREATE TABLE injuredsegments (
path BLOB NOT NULL,
data BLOB NOT NULL,
attempted TIMESTAMP,
PRIMARY KEY ( path )
);
CREATE TABLE irreparabledbs (
segmentpath BLOB NOT NULL,
segmentdetail BLOB NOT NULL,
pieces_lost_count INTEGER NOT NULL,
seg_damaged_unix_sec INTEGER NOT NULL,
repair_attempt_count INTEGER NOT NULL,
PRIMARY KEY ( segmentpath )
);
CREATE TABLE nodes (
id BLOB NOT NULL,
address TEXT NOT NULL,
2019-06-24 16:33:18 +01:00
last_net TEXT NOT NULL,
protocol INTEGER NOT NULL,
type INTEGER NOT NULL,
email TEXT NOT NULL,
wallet TEXT NOT NULL,
free_bandwidth INTEGER NOT NULL,
free_disk INTEGER NOT NULL,
piece_count INTEGER NOT NULL,
Add Version Information into KAD Network and SatelliteDB & Change Selection Process (#1648) * Initial Webserver Draft for Version Controlling * Rename type to avoid confusion * Move Function Calls into Version Package * Fix Linting and Language Typos * Fix Linting and Spelling Mistakes * Include Copyright * Include Copyright * Adjust Version-Control Server to return list of Versions * Linting * Improve Request Handling and Readability * Add Configuration File Option Add Systemd Service file * Add Logging to File * Smaller Changes * Add Semantic Versioning and refuses outdated Software from Startup (#1612) * implements internal Semantic Version library * adds version logging + reporting to process * Advance SemVer struct for easier handling * Add Accepted Version Store * Fix Function * Restructure * Type Conversion * Handle Version String properly * Add Note about array index * Set temporary Default Version * Add Copyright * Adding Version to Dashboard * Adding Version Info Log * Renaming and adding CheckerProcess * Iteration Sync * Iteration V2 * linting * made LogAndReportVersion a go routine * Refactor to Go Routine * Add Context to Go Routine and allow Operation if Lookup to Control Server fails * Handle Unmarshal properly * Linting * Relocate Version Checks * Relocating Version Check and specified default Version for now * Linting Error Prevention * Refuse Startup on outdated Version * Add Startup Check Function * Straighten Logging * Dont force Shutdown if --dev flag is set * Create full Service/Peer Structure for ControlServer * Linting * Straighting Naming * Finish VersionControl Service Layout * Improve Error Handling * Change Listening Address * Move Checker Function * Remove VersionControl Peer * Linting * Linting * Create VersionClient Service * Renaming * Add Version Client to Peer Definitions * Linting and Renaming * Linting * Remove Transport Checks for now * Move to Client Side Flag * Remove check * Linting * Transport Client Version Intro * Adding Version Client to Transport Client * Add missing parameter * Adding Version Check, to set Allowed = true * Set Default to true, testing * Restructuring Code * Uplink Changes * Add more proper Defaults * Renaming of Version struct * Dont pass Service use Pointer * Set Defaults for Versioning Checks * Put HTTP Server in go routine * Add Versioncontrol to Storj-Sim * Testplanet Fixes * Linting * Add Error Handling and new Server Struct * Move Lock slightly * Reduce Race Potentials * Remove unnecessary files * Linting * Add Proper Transport Handling * small fixes * add fence for allowed check * Add Startup Version Check and Service Naming * make errormessage private * Add Comments about VersionedClient * Linting * Remove Checks that refuse outgoing connections * Remove release cmd * Add Release Script * Linting * Update to use correct Values * Change Timestamp handling * Adding Protobuf changes back in * Adding SatelliteDB Changes and adding Storj Node Version to PB * Add Migration Table * Add Default Stats for Creation * Move to BigInt * Proper SQL Migration * Ensure minimum Version is passed to the node selection * Linting... * Remove VersionedClient and adjust smaller changes from prior merge * Linting * Fix PB Message Handling and Query for Node Selection * some future-proofing type changes Change-Id: I3cb5018dcccdbc9739fe004d859065992720caaf * fix a compiler error Change-Id: If66bb92d8b98e31cd618ecec9c6448ab9b037fa5 * Comment on Constant for Overlay * Remove NOT NULL and add epoch call as function * add versions to bootstrap and satellites Change-Id: I436944589ea5f21600cdd997742a84fe0b16e47b * Change Update Migration * Fix DB Migration * Increase Timeout temporarily, to see whats going on * Remove unnecessary const and vars Cleanup Function calls from deprecated NodeVersion struct * Updated Protopuf, removed depcreated Code from Inspector * Implement NodeVersion into InfoResponse * Regenerated locked.go * Linting * Fix Tests * Remove unnecessary constant * Update Function and Flag Description * Remove Empty Stat Creation * return properly with error * Remove unnecessary struct * simplify migration step * Update Inspector to return Version Info * Update local Endpoint Version Handling * Reset Travis Timeout * Add Default for CommitHash * single quotes
2019-04-10 07:04:24 +01:00
major INTEGER NOT NULL,
minor INTEGER NOT NULL,
patch INTEGER NOT NULL,
hash TEXT NOT NULL,
timestamp TIMESTAMP NOT NULL,
release INTEGER NOT NULL,
latency_90 INTEGER NOT NULL,
audit_success_count INTEGER NOT NULL,
total_audit_count INTEGER NOT NULL,
uptime_success_count INTEGER NOT NULL,
total_uptime_count INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
last_contact_success TIMESTAMP NOT NULL,
last_contact_failure TIMESTAMP NOT NULL,
contained INTEGER NOT NULL,
disqualified TIMESTAMP,
audit_reputation_alpha REAL NOT NULL,
audit_reputation_beta REAL NOT NULL,
uptime_reputation_alpha REAL NOT NULL,
uptime_reputation_beta REAL NOT NULL,
exit_initiated_at TIMESTAMP,
exit_loop_completed_at TIMESTAMP,
exit_finished_at TIMESTAMP,
PRIMARY KEY ( id )
);
CREATE TABLE offers (
id INTEGER NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL,
award_credit_in_cents INTEGER NOT NULL,
invitee_credit_in_cents INTEGER NOT NULL,
award_credit_duration_days INTEGER,
invitee_credit_duration_days INTEGER,
redeemable_cap INTEGER,
expires_at TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL,
status INTEGER NOT NULL,
type INTEGER NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE peer_identities (
node_id BLOB NOT NULL,
leaf_serial_number BLOB NOT NULL,
chain BLOB NOT NULL,
updated_at TIMESTAMP NOT NULL,
PRIMARY KEY ( node_id )
);
CREATE TABLE pending_audits (
node_id BLOB NOT NULL,
piece_id BLOB NOT NULL,
stripe_index INTEGER NOT NULL,
share_size INTEGER NOT NULL,
expected_share_hash BLOB NOT NULL,
reverify_count INTEGER NOT NULL,
path BLOB NOT NULL,
PRIMARY KEY ( node_id )
);
CREATE TABLE projects (
id BLOB NOT NULL,
name TEXT NOT NULL,
description TEXT NOT NULL,
usage_limit INTEGER NOT NULL,
partner_id BLOB,
owner_id BLOB NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE registration_tokens (
secret BLOB NOT NULL,
owner_id BLOB,
project_limit INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( secret ),
UNIQUE ( owner_id )
);
CREATE TABLE reset_password_tokens (
secret BLOB NOT NULL,
owner_id BLOB NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( secret ),
UNIQUE ( owner_id )
);
CREATE TABLE serial_numbers (
id INTEGER NOT NULL,
serial_number BLOB NOT NULL,
bucket_id BLOB NOT NULL,
expires_at TIMESTAMP NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE storagenode_bandwidth_rollups (
storagenode_id BLOB NOT NULL,
interval_start TIMESTAMP NOT NULL,
interval_seconds INTEGER NOT NULL,
action INTEGER NOT NULL,
allocated INTEGER NOT NULL,
settled INTEGER NOT NULL,
PRIMARY KEY ( storagenode_id, interval_start, action )
);
CREATE TABLE storagenode_storage_tallies (
id INTEGER NOT NULL,
node_id BLOB NOT NULL,
interval_end_time TIMESTAMP NOT NULL,
data_total REAL NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE users (
id BLOB NOT NULL,
email TEXT NOT NULL,
normalized_email TEXT NOT NULL,
full_name TEXT NOT NULL,
short_name TEXT,
password_hash BLOB NOT NULL,
status INTEGER NOT NULL,
partner_id BLOB,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE value_attributions (
project_id BLOB NOT NULL,
bucket_name BLOB NOT NULL,
partner_id BLOB NOT NULL,
last_updated TIMESTAMP NOT NULL,
PRIMARY KEY ( project_id, bucket_name )
);
CREATE TABLE api_keys (
id BLOB NOT NULL,
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
head BLOB NOT NULL,
name TEXT NOT NULL,
secret BLOB NOT NULL,
partner_id BLOB,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( id ),
UNIQUE ( head ),
UNIQUE ( name, project_id )
);
CREATE TABLE bucket_metainfos (
id BLOB NOT NULL,
project_id BLOB NOT NULL REFERENCES projects( id ),
name BLOB NOT NULL,
partner_id BLOB,
path_cipher INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL,
default_segment_size INTEGER NOT NULL,
default_encryption_cipher_suite INTEGER NOT NULL,
default_encryption_block_size INTEGER NOT NULL,
default_redundancy_algorithm INTEGER NOT NULL,
default_redundancy_share_size INTEGER NOT NULL,
default_redundancy_required_shares INTEGER NOT NULL,
default_redundancy_repair_shares INTEGER NOT NULL,
default_redundancy_optimal_shares INTEGER NOT NULL,
default_redundancy_total_shares INTEGER NOT NULL,
PRIMARY KEY ( id ),
UNIQUE ( name, project_id )
);
CREATE TABLE project_invoice_stamps (
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
invoice_id BLOB NOT NULL,
start_date TIMESTAMP NOT NULL,
end_date TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( project_id, start_date, end_date ),
UNIQUE ( invoice_id )
);
CREATE TABLE project_members (
member_id BLOB NOT NULL REFERENCES users( id ) ON DELETE CASCADE,
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( member_id, project_id )
);
CREATE TABLE used_serials (
serial_number_id INTEGER NOT NULL REFERENCES serial_numbers( id ) ON DELETE CASCADE,
storage_node_id BLOB NOT NULL,
PRIMARY KEY ( serial_number_id, storage_node_id )
);
CREATE TABLE user_credits (
id INTEGER NOT NULL,
user_id BLOB NOT NULL REFERENCES users( id ) ON DELETE CASCADE,
offer_id INTEGER NOT NULL REFERENCES offers( id ),
referred_by BLOB REFERENCES users( id ) ON DELETE SET NULL,
type TEXT NOT NULL,
credits_earned_in_cents INTEGER NOT NULL,
credits_used_in_cents INTEGER NOT NULL,
expires_at TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( id )
);
CREATE TABLE user_payments (
user_id BLOB NOT NULL REFERENCES users( id ) ON DELETE CASCADE,
customer_id BLOB NOT NULL,
created_at TIMESTAMP NOT NULL,
PRIMARY KEY ( user_id ),
UNIQUE ( customer_id )
);
CREATE TABLE project_payments (
2019-07-10 21:29:26 +01:00
id BLOB NOT NULL,
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
payer_id BLOB NOT NULL REFERENCES user_payments( user_id ) ON DELETE CASCADE,
payment_method_id BLOB NOT NULL,
2019-07-10 21:29:26 +01:00
is_default INTEGER NOT NULL,
created_at TIMESTAMP NOT NULL,
2019-07-10 21:29:26 +01:00
PRIMARY KEY ( id )
);
CREATE INDEX bucket_name_project_id_interval_start_interval_seconds ON bucket_bandwidth_rollups ( bucket_name, project_id, interval_start, interval_seconds );
CREATE UNIQUE INDEX bucket_id_rollup ON bucket_usages ( bucket_id, rollup_end_time );
CREATE INDEX injuredsegments_attempted_index ON injuredsegments ( attempted );
2019-06-24 16:33:18 +01:00
CREATE INDEX node_last_ip ON nodes ( last_net );
CREATE UNIQUE INDEX serial_number ON serial_numbers ( serial_number );
CREATE INDEX serial_numbers_expires_at_index ON serial_numbers ( expires_at );
CREATE INDEX storagenode_id_interval_start_interval_seconds ON storagenode_bandwidth_rollups ( storagenode_id, interval_start, interval_seconds );