Skip to content

Add ghost schema #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2020
Merged

Add ghost schema #101

merged 1 commit into from
Mar 2, 2020

Conversation

2color
Copy link
Contributor

@2color 2color commented Feb 24, 2020

Introspection works.

Resulting schema.prisma:

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = "mysql://root:OBFUSCATED@127.0.0.1:3306/ghost"
}

model actions {
  actor_id      String
  actor_type    String
  context       String?
  created_at    DateTime
  event         String
  id            String   @id
  resource_id   String?
  resource_type String
}

model api_keys {
  created_at        DateTime
  created_by        String
  id                String    @id
  integration_id    String?
  last_seen_at      DateTime?
  last_seen_version String?
  role_id           String?
  secret            String    @unique
  type              String
  updated_at        DateTime?
  updated_by        String?
}

model apps {
  created_at   DateTime
  created_by   String
  id           String         @id
  name         String         @unique
  slug         String         @unique
  status       String         @default("inactive")
  updated_at   DateTime?
  updated_by   String?
  version      String
  app_fields   app_fields[]
  app_settings app_settings[]
}

model app_fields {
  active         Boolean   @default(true)
  created_at     DateTime
  created_by     String
  id             String    @id
  key            String
  relatable_id   String
  relatable_type String    @default("posts")
  type           String    @default("html")
  updated_at     DateTime?
  updated_by     String?
  value          String?
  app_id         apps

  @@index([app_id], name: "app_fields_app_id_foreign")
}

model app_settings {
  created_at DateTime
  created_by String
  id         String    @id
  key        String    @unique
  updated_at DateTime?
  updated_by String?
  value      String?
  app_id     apps

  @@index([app_id], name: "app_settings_app_id_foreign")
}

/// The underlying table does not contain a unique identifier and can therefore currently not be handled.
// model brute {
  // count        Int
  // firstRequest Int
  // key          String
  // lastRequest  Int
  // lifetime     Int
// }

model emails {
  created_at   DateTime
  created_by   String
  email_count  Int       @default(0)
  error        String?
  error_data   String?
  html         String?
  id           String    @id
  meta         String?
  plaintext    String?
  post_id      String    @unique
  stats        String?
  status       String    @default("pending")
  subject      String?
  submitted_at DateTime
  updated_at   DateTime?
  updated_by   String?
  uuid         String

  @@index([post_id], name: "emails_post_id_index")
}

model integrations {
  created_at  DateTime
  created_by  String
  description String?
  icon_image  String?
  id          String    @id
  name        String
  slug        String    @unique
  type        String    @default("custom")
  updated_at  DateTime?
  updated_by  String?
}

model invites {
  created_at DateTime
  created_by String
  email      String    @unique
  expires    Int
  id         String    @id
  role_id    String
  status     String    @default("pending")
  token      String    @unique
  updated_at DateTime?
  updated_by String?
}

model labels {
  created_at     DateTime
  created_by     String
  id             String           @id
  name           String           @unique
  slug           String           @unique
  updated_at     DateTime?
  updated_by     String?
  members_labels members_labels[]
}

model members {
  created_at     DateTime
  created_by     String
  email          String           @unique
  id             String           @id
  name           String?
  note           String?
  subscribed     Boolean?         @default(true)
  updated_at     DateTime?
  updated_by     String?
  uuid           String?          @unique
  members_labels members_labels[]
}

model members_labels {
  id         String  @id
  sort_order Int     @default(0)
  label_id   labels
  member_id  members

  @@index([label_id], name: "members_labels_label_id_foreign")
  @@index([member_id], name: "members_labels_member_id_foreign")
}

model members_stripe_customers {
  created_at  DateTime
  created_by  String
  customer_id String
  email       String?
  id          String    @id
  member_id   String
  name        String?
  updated_at  DateTime?
  updated_by  String?
}

model members_stripe_customers_subscriptions {
  cancel_at_period_end       Boolean   @default(false)
  created_at                 DateTime
  created_by                 String
  current_period_end         DateTime
  customer_id                String
  default_payment_card_last4 String?
  id                         String    @id
  plan_amount                Int
  plan_currency              String
  plan_id                    String
  plan_interval              String
  plan_nickname              String
  start_date                 DateTime
  status                     String
  subscription_id            String
  updated_at                 DateTime?
  updated_by                 String?
}

model migrations {
  currentVersion String?
  id             Int     @default(autoincrement()) @id
  name           String
  version        String

  @@unique([name, version], name: "migrations_name_version_unique")
}

model migrations_lock {
  acquired_at DateTime?
  locked      Boolean?  @default(false)
  lock_key    String    @unique
  released_at DateTime?
}

model mobiledoc_revisions {
  created_at    DateTime
  created_at_ts Int
  id            String   @id
  mobiledoc     String?
  post_id       String

  @@index([post_id], name: "mobiledoc_revisions_post_id_index")
}

model permissions {
  action_type String
  created_at  DateTime
  created_by  String
  id          String    @id
  name        String    @unique
  object_id   String?
  object_type String
  updated_at  DateTime?
  updated_by  String?
}

model permissions_apps {
  app_id        String
  id            String @id
  permission_id String
}

model permissions_roles {
  id            String @id
  permission_id String
  role_id       String
}

model permissions_users {
  id            String @id
  permission_id String
  user_id       String
}

model posts {
  author_id                 String
  canonical_url             String?
  codeinjection_foot        String?
  codeinjection_head        String?
  comment_id                String?
  created_at                DateTime
  created_by                String
  custom_excerpt            String?
  custom_template           String?
  featured                  Boolean         @default(false)
  feature_image             String?
  html                      String?
  id                        String          @id
  locale                    String?
  mobiledoc                 String?
  plaintext                 String?
  published_at              DateTime?
  published_by              String?
  send_email_when_published Boolean?        @default(false)
  slug                      String          @unique
  status                    String          @default("draft")
  title                     String
  type                      String          @default("post")
  updated_at                DateTime?
  updated_by                String?
  uuid                      String
  visibility                String          @default("public")
  posts_authors             posts_authors[]
  posts_meta                posts_meta?
  posts_tags                posts_tags[]
}

model posts_authors {
  id         String @id
  sort_order Int    @default(0)
  author_id  users
  post_id    posts

  @@index([author_id], name: "posts_authors_author_id_foreign")
  @@index([post_id], name: "posts_authors_post_id_foreign")
}

model posts_meta {
  email_subject       String?
  id                  String  @id
  meta_description    String?
  meta_title          String?
  og_description      String?
  og_image            String?
  og_title            String?
  twitter_description String?
  twitter_image       String?
  twitter_title       String?
  post_id             posts
}

model posts_tags {
  id         String @id
  sort_order Int    @default(0)
  post_id    posts
  tag_id     tags

  @@index([post_id], name: "posts_tags_post_id_foreign")
  @@index([tag_id], name: "posts_tags_tag_id_foreign")
}

model roles {
  created_at  DateTime
  created_by  String
  description String?
  id          String    @id
  name        String    @unique
  updated_at  DateTime?
  updated_by  String?
}

model roles_users {
  id      String @id
  role_id String
  user_id String
}

model sessions {
  created_at   DateTime
  id           String    @id
  session_data String
  session_id   String    @unique
  updated_at   DateTime?
  user_id      String
}

model settings {
  created_at DateTime
  created_by String
  id         String    @id
  key        String    @unique
  type       String    @default("core")
  updated_at DateTime?
  updated_by String?
  value      String?
}

model tags {
  created_at       DateTime
  created_by       String
  description      String?
  feature_image    String?
  id               String       @id
  meta_description String?
  meta_title       String?
  name             String
  parent_id        String?
  slug             String       @unique
  updated_at       DateTime?
  updated_by       String?
  visibility       String       @default("public")
  posts_tags       posts_tags[]
}

model users {
  accessibility    String?
  bio              String?
  cover_image      String?
  created_at       DateTime
  created_by       String
  email            String          @unique
  facebook         String?
  id               String          @id
  last_seen        DateTime?
  locale           String?
  location         String?
  meta_description String?
  meta_title       String?
  name             String
  password         String
  profile_image    String?
  slug             String          @unique
  status           String          @default("active")
  tour             String?
  twitter          String?
  updated_at       DateTime?
  updated_by       String?
  visibility       String          @default("public")
  website          String?
  posts_authors    posts_authors[]
}

model webhooks {
  api_version           String    @default("v2")
  created_at            DateTime
  created_by            String
  event                 String
  id                    String    @id
  integration_id        String?
  last_triggered_at     DateTime?
  last_triggered_error  String?
  last_triggered_status String?
  name                  String?
  secret                String?
  status                String    @default("available")
  target_url            String
  updated_at            DateTime?
  updated_by            String?
}

@2color 2color requested a review from divyenduz February 24, 2020 11:07
@janpio janpio added this to the Preview 23 milestone Feb 24, 2020
Copy link

@divyenduz divyenduz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@divyenduz divyenduz merged commit cdba7b8 into master Mar 2, 2020
@divyenduz divyenduz deleted the add-ghost branch March 2, 2020 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants