zkt24/z2/backend/ent/migrate/schema.go

178 lines
6.2 KiB
Go
Raw Permalink Normal View History

2024-04-25 11:51:47 +00:00
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// BlocksColumns holds the columns for the "blocks" table.
BlocksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "hash", Type: field.TypeString, Unique: true},
{Name: "length", Type: field.TypeInt},
{Name: "previous_hash", Type: field.TypeString, Unique: true},
}
// BlocksTable holds the schema information for the "blocks" table.
BlocksTable = &schema.Table{
Name: "blocks",
Columns: BlocksColumns,
PrimaryKey: []*schema.Column{BlocksColumns[0]},
}
// KeysColumns holds the columns for the "keys" table.
KeysColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "public_key", Type: field.TypeString, Unique: true},
{Name: "owner", Type: field.TypeString},
{Name: "trust_score", Type: field.TypeFloat64, Default: 0.2},
{Name: "validators_key", Type: field.TypeInt, Nullable: true},
{Name: "white_list_account", Type: field.TypeInt, Nullable: true},
}
// KeysTable holds the schema information for the "keys" table.
KeysTable = &schema.Table{
Name: "keys",
Columns: KeysColumns,
PrimaryKey: []*schema.Column{KeysColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "keys_validators_key",
Columns: []*schema.Column{KeysColumns[4]},
RefColumns: []*schema.Column{ValidatorsColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "keys_white_lists_Account",
Columns: []*schema.Column{KeysColumns[5]},
RefColumns: []*schema.Column{WhiteListsColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// TransactionsColumns holds the columns for the "transactions" table.
TransactionsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "type", Type: field.TypeInt},
{Name: "timestamp", Type: field.TypeInt},
{Name: "comment", Type: field.TypeString},
{Name: "content", Type: field.TypeBytes},
{Name: "hash", Type: field.TypeString, Unique: true},
{Name: "signature", Type: field.TypeString, Unique: true},
}
// TransactionsTable holds the schema information for the "transactions" table.
TransactionsTable = &schema.Table{
Name: "transactions",
Columns: TransactionsColumns,
PrimaryKey: []*schema.Column{TransactionsColumns[0]},
}
// ValidatorsColumns holds the columns for the "validators" table.
ValidatorsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "facilitator", Type: field.TypeString},
{Name: "blocks_caster", Type: field.TypeInt, Nullable: true},
{Name: "white_list_sponsor", Type: field.TypeInt, Nullable: true},
}
// ValidatorsTable holds the schema information for the "validators" table.
ValidatorsTable = &schema.Table{
Name: "validators",
Columns: ValidatorsColumns,
PrimaryKey: []*schema.Column{ValidatorsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "validators_blocks_Caster",
Columns: []*schema.Column{ValidatorsColumns[2]},
RefColumns: []*schema.Column{BlocksColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "validators_white_lists_Sponsor",
Columns: []*schema.Column{ValidatorsColumns[3]},
RefColumns: []*schema.Column{WhiteListsColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// WhiteListsColumns holds the columns for the "white_lists" table.
WhiteListsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
}
// WhiteListsTable holds the schema information for the "white_lists" table.
WhiteListsTable = &schema.Table{
Name: "white_lists",
Columns: WhiteListsColumns,
PrimaryKey: []*schema.Column{WhiteListsColumns[0]},
}
// BlocksMinedTxsColumns holds the columns for the "blocks_MinedTxs" table.
BlocksMinedTxsColumns = []*schema.Column{
{Name: "blocks_id", Type: field.TypeInt},
{Name: "transactions_id", Type: field.TypeInt},
}
// BlocksMinedTxsTable holds the schema information for the "blocks_MinedTxs" table.
BlocksMinedTxsTable = &schema.Table{
Name: "blocks_MinedTxs",
Columns: BlocksMinedTxsColumns,
PrimaryKey: []*schema.Column{BlocksMinedTxsColumns[0], BlocksMinedTxsColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "blocks_MinedTxs_blocks_id",
Columns: []*schema.Column{BlocksMinedTxsColumns[0]},
RefColumns: []*schema.Column{BlocksColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "blocks_MinedTxs_transactions_id",
Columns: []*schema.Column{BlocksMinedTxsColumns[1]},
RefColumns: []*schema.Column{TransactionsColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// KeySignedColumns holds the columns for the "key_Signed" table.
KeySignedColumns = []*schema.Column{
{Name: "key_id", Type: field.TypeInt},
{Name: "transactions_id", Type: field.TypeInt},
}
// KeySignedTable holds the schema information for the "key_Signed" table.
KeySignedTable = &schema.Table{
Name: "key_Signed",
Columns: KeySignedColumns,
PrimaryKey: []*schema.Column{KeySignedColumns[0], KeySignedColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "key_Signed_key_id",
Columns: []*schema.Column{KeySignedColumns[0]},
RefColumns: []*schema.Column{KeysColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "key_Signed_transactions_id",
Columns: []*schema.Column{KeySignedColumns[1]},
RefColumns: []*schema.Column{TransactionsColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
BlocksTable,
KeysTable,
TransactionsTable,
ValidatorsTable,
WhiteListsTable,
BlocksMinedTxsTable,
KeySignedTable,
}
)
func init() {
KeysTable.ForeignKeys[0].RefTable = ValidatorsTable
KeysTable.ForeignKeys[1].RefTable = WhiteListsTable
ValidatorsTable.ForeignKeys[0].RefTable = BlocksTable
ValidatorsTable.ForeignKeys[1].RefTable = WhiteListsTable
BlocksMinedTxsTable.ForeignKeys[0].RefTable = BlocksTable
BlocksMinedTxsTable.ForeignKeys[1].RefTable = TransactionsTable
KeySignedTable.ForeignKeys[0].RefTable = KeysTable
KeySignedTable.ForeignKeys[1].RefTable = TransactionsTable
}