CREATE TABLE IF NOT EXISTS "app_metadata" (
	"id" text PRIMARY KEY NOT NULL,
	"data" text,
	"crowdin_id" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "crowdin_credentials" (
	"id" text PRIMARY KEY NOT NULL,
	"app_secret" text,
	"domain" text,
	"user_id" text,
	"agent_id" text,
	"organization_id" text,
	"base_url" text,
	"access_token" text NOT NULL,
	"refresh_token" text NOT NULL,
	"expire" text NOT NULL,
	"type" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "files_snapshot" (
	"id" serial PRIMARY KEY NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"files" text,
	"provider" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "integration_credentials" (
	"id" text PRIMARY KEY NOT NULL,
	"credentials" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"managers" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "integration_settings" (
	"id" serial PRIMARY KEY NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"config" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "job" (
	"id" text PRIMARY KEY NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"type" text NOT NULL,
	"title" text,
	"progress" integer DEFAULT 0 NOT NULL,
	"status" text DEFAULT 'CREATED' NOT NULL,
	"payload" text,
	"info" text,
	"data" text,
	"attempt" integer DEFAULT 0 NOT NULL,
	"errors" text,
	"processed_entities" text,
	"initiated_by" text,
	"created_at" text NOT NULL,
	"updated_at" text,
	"finished_at" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "sync_settings" (
	"id" serial PRIMARY KEY NOT NULL,
	"files" text,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"type" text NOT NULL,
	"provider" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "synced_data" (
	"id" serial PRIMARY KEY NOT NULL,
	"files" text,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"type" text NOT NULL,
	"updated_at" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "translation_file_cache" (
	"id" serial PRIMARY KEY NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"file_id" integer NOT NULL,
	"language_id" text NOT NULL,
	"etag" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "unsynced_files" (
	"id" serial PRIMARY KEY NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"files" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "user_errors" (
	"id" serial PRIMARY KEY NOT NULL,
	"action" text NOT NULL,
	"message" text NOT NULL,
	"data" text,
	"created_at" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"integration_id" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "webhooks" (
	"id" serial PRIMARY KEY NOT NULL,
	"file_id" text NOT NULL,
	"integration_id" text NOT NULL,
	"crowdin_id" text NOT NULL,
	"provider" text NOT NULL
);
