initial commit

This commit is contained in:
maurice fletgen
2022-09-08 09:18:04 +02:00
commit 447b2fb51d
163 changed files with 47569 additions and 0 deletions

65
ent/migrate/migrate.go Normal file
View File

@ -0,0 +1,65 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
//
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}

231
ent/migrate/schema.go Normal file
View File

@ -0,0 +1,231 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// ActionsColumns holds the columns for the "actions" table.
ActionsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "refid", Type: field.TypeString},
{Name: "commiter", Type: field.TypeString},
{Name: "serverid", Type: field.TypeString},
{Name: "target", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "duration", Type: field.TypeString},
{Name: "reason", Type: field.TypeString},
{Name: "temp", Type: field.TypeBool, Default: false},
}
// ActionsTable holds the schema information for the "actions" table.
ActionsTable = &schema.Table{
Name: "actions",
Columns: ActionsColumns,
PrimaryKey: []*schema.Column{ActionsColumns[0]},
}
// AuthorizablesColumns holds the columns for the "authorizables" table.
AuthorizablesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "username", Type: field.TypeString},
{Name: "password", Type: field.TypeString},
{Name: "serverid", Type: field.TypeString},
{Name: "userid", Type: field.TypeString},
}
// AuthorizablesTable holds the schema information for the "authorizables" table.
AuthorizablesTable = &schema.Table{
Name: "authorizables",
Columns: AuthorizablesColumns,
PrimaryKey: []*schema.Column{AuthorizablesColumns[0]},
}
// BlacklistsColumns holds the columns for the "blacklists" table.
BlacklistsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "word", Type: field.TypeString},
}
// BlacklistsTable holds the schema information for the "blacklists" table.
BlacklistsTable = &schema.Table{
Name: "blacklists",
Columns: BlacklistsColumns,
PrimaryKey: []*schema.Column{BlacklistsColumns[0]},
}
// LoggingsColumns holds the columns for the "loggings" table.
LoggingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "commiter", Type: field.TypeString},
{Name: "description", Type: field.TypeString},
}
// LoggingsTable holds the schema information for the "loggings" table.
LoggingsTable = &schema.Table{
Name: "loggings",
Columns: LoggingsColumns,
PrimaryKey: []*schema.Column{LoggingsColumns[0]},
}
// PunishmentsColumns holds the columns for the "punishments" table.
PunishmentsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "warnamount", Type: field.TypeString},
{Name: "actiontype", Type: field.TypeString},
{Name: "duration", Type: field.TypeString},
{Name: "reason", Type: field.TypeString},
}
// PunishmentsTable holds the schema information for the "punishments" table.
PunishmentsTable = &schema.Table{
Name: "punishments",
Columns: PunishmentsColumns,
PrimaryKey: []*schema.Column{PunishmentsColumns[0]},
}
// ServersColumns holds the columns for the "servers" table.
ServersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "userid", Type: field.TypeString},
{Name: "serverid", Type: field.TypeString},
{Name: "is_owner", Type: field.TypeBool},
{Name: "permission", Type: field.TypeString},
}
// ServersTable holds the schema information for the "servers" table.
ServersTable = &schema.Table{
Name: "servers",
Columns: ServersColumns,
PrimaryKey: []*schema.Column{ServersColumns[0]},
}
// SettingsColumns holds the columns for the "settings" table.
SettingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "servername", Type: field.TypeString},
{Name: "ownerid", Type: field.TypeString},
{Name: "permtoken", Type: field.TypeString},
{Name: "apitoken", Type: field.TypeString},
{Name: "statspagemode", Type: field.TypeString},
{Name: "loggerchannel", Type: field.TypeString},
{Name: "spamchannel", Type: field.TypeString},
{Name: "greeterchannel", Type: field.TypeString},
{Name: "greetermode", Type: field.TypeString},
{Name: "announcechannel", Type: field.TypeString},
{Name: "logger", Type: field.TypeBool, Default: false},
{Name: "spamprotection", Type: field.TypeBool, Default: false},
{Name: "linkprotection", Type: field.TypeBool, Default: false},
{Name: "wordfilter", Type: field.TypeBool, Default: false},
{Name: "greetings", Type: field.TypeBool, Default: false},
{Name: "apitoggle", Type: field.TypeBool, Default: false},
{Name: "moderation", Type: field.TypeBool, Default: false},
{Name: "automatedmoderation", Type: field.TypeBool, Default: false},
{Name: "twitchannounce", Type: field.TypeBool, Default: false},
{Name: "twitterannounce", Type: field.TypeBool, Default: false},
{Name: "music", Type: field.TypeBool, Default: false},
{Name: "statspage", Type: field.TypeBool, Default: false},
{Name: "statsprivate", Type: field.TypeBool, Default: false},
{Name: "stats", Type: field.TypeBool, Default: false},
}
// SettingsTable holds the schema information for the "settings" table.
SettingsTable = &schema.Table{
Name: "settings",
Columns: SettingsColumns,
PrimaryKey: []*schema.Column{SettingsColumns[0]},
}
// SocialmediaColumns holds the columns for the "socialmedia" table.
SocialmediaColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "identificator", Type: field.TypeString},
}
// SocialmediaTable holds the schema information for the "socialmedia" table.
SocialmediaTable = &schema.Table{
Name: "socialmedia",
Columns: SocialmediaColumns,
PrimaryKey: []*schema.Column{SocialmediaColumns[0]},
}
// SupportsColumns holds the columns for the "supports" table.
SupportsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "refid", Type: field.TypeString},
{Name: "serverid", Type: field.TypeString},
{Name: "creator", Type: field.TypeString},
{Name: "status", Type: field.TypeString},
{Name: "title", Type: field.TypeString},
{Name: "description", Type: field.TypeString},
}
// SupportsTable holds the schema information for the "supports" table.
SupportsTable = &schema.Table{
Name: "supports",
Columns: SupportsColumns,
PrimaryKey: []*schema.Column{SupportsColumns[0]},
}
// SupportResponsesColumns holds the columns for the "support_responses" table.
SupportResponsesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "refid", Type: field.TypeString},
{Name: "writer", Type: field.TypeString},
{Name: "message", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "rtcchannel", Type: field.TypeString},
{Name: "isread", Type: field.TypeBool},
{Name: "created", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
}
// SupportResponsesTable holds the schema information for the "support_responses" table.
SupportResponsesTable = &schema.Table{
Name: "support_responses",
Columns: SupportResponsesColumns,
PrimaryKey: []*schema.Column{SupportResponsesColumns[0]},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "serverid", Type: field.TypeString},
{Name: "userid", Type: field.TypeString},
{Name: "username", Type: field.TypeString},
{Name: "xp", Type: field.TypeInt, Default: 0},
{Name: "level", Type: field.TypeInt, Default: 1},
{Name: "msgs", Type: field.TypeInt, Default: 0},
{Name: "created", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
}
// WarnsColumns holds the columns for the "warns" table.
WarnsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "emitter", Type: field.TypeString},
{Name: "serverid", Type: field.TypeString},
{Name: "target", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "duration", Type: field.TypeString},
{Name: "reason", Type: field.TypeString},
{Name: "refid", Type: field.TypeString, Unique: true},
}
// WarnsTable holds the schema information for the "warns" table.
WarnsTable = &schema.Table{
Name: "warns",
Columns: WarnsColumns,
PrimaryKey: []*schema.Column{WarnsColumns[0]},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
ActionsTable,
AuthorizablesTable,
BlacklistsTable,
LoggingsTable,
PunishmentsTable,
ServersTable,
SettingsTable,
SocialmediaTable,
SupportsTable,
SupportResponsesTable,
UsersTable,
WarnsTable,
}
)
func init() {
}