Skip to content

Instantly share code, notes, and snippets.

@rjcorwin
Created March 7, 2013 00:30
Show Gist options
  • Save rjcorwin/5104496 to your computer and use it in GitHub Desktop.
Save rjcorwin/5104496 to your computer and use it in GitHub Desktop.
I ran a .schema on a ka-lite database and tried to prune out the Django specific tables so we can see the data model that ka-lite is working with.
CREATE TABLE "main_exerciselog" (
"signed_version" integer NOT NULL,
"user_id" varchar(32),
"complete" bool NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"completion_timestamp" datetime,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signature" varchar(360) NOT NULL,
"signed_by_id" varchar(32),
"attempts" integer NOT NULL,
"points" integer NOT NULL DEFAULT 0,
"exercise_id" varchar(100) NOT NULL,
"streak_progress" integer NOT NULL,
"struggling" bool NOT NULL DEFAULT 0,
"attempts_before_completion" integer,
"id" varchar(32) PRIMARY KEY UNIQUE,
"completion_counter" integer
);
CREATE TABLE "main_languagepack" (
"lang_id" varchar(5) NOT NULL PRIMARY KEY,
"lang_version" varchar(5) NOT NULL,
"software_version" varchar(12) NOT NULL,
"lang_name" varchar(30) NOT NULL
);
CREATE TABLE "main_videofile" (
"flagged_for_download" bool NOT NULL,
"flagged_for_subtitle_download" bool NOT NULL DEFAULT 0,
"cancel_download" bool NOT NULL DEFAULT 0,
"subtitles_downloaded" bool NOT NULL DEFAULT 0,
"priority" integer NOT NULL DEFAULT 0,
"subtitle_download_in_progress" bool NOT NULL DEFAULT 0,
"youtube_id" varchar(20) NOT NULL PRIMARY KEY UNIQUE,
"download_in_progress" bool NOT NULL,
"percent_complete" integer NOT NULL
);
CREATE TABLE "main_videolog" (
"total_seconds_watched" integer NOT NULL,
"signed_version" integer NOT NULL,
"user_id" varchar(32),
"complete" bool NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signed_by_id" varchar(32),
"youtube_id" varchar(20) NOT NULL,
"points" integer NOT NULL,
"signature" varchar(360) NOT NULL,
"completion_timestamp" datetime,
"id" varchar(32) PRIMARY KEY UNIQUE,
"completion_counter" integer
);
CREATE TABLE "securesync_device" (
"public_key" varchar(500) NOT NULL,
"signed_version" integer NOT NULL,
"name" varchar(100) NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signed_by_id" varchar(32),
"signature" varchar(360) NOT NULL,
"id" varchar(32) PRIMARY KEY UNIQUE,
"description" text NOT NULL
);
CREATE TABLE "securesync_devicemetadata" (
"id" integer NOT NULL PRIMARY KEY,
"device_id" varchar(32) NULL UNIQUE,
"is_trusted" bool NOT NULL,
"is_own_device" bool NOT NULL,
"counter_position" integer NOT NULL
);
CREATE TABLE "securesync_devicezone" (
"signed_version" integer NOT NULL,
"zone_id" varchar(32) NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signed_by_id" varchar(32),
"signature" varchar(360) NOT NULL,
"device_id" varchar(32) NOT NULL UNIQUE,
"max_counter" integer NULL,
"id" varchar(32) PRIMARY KEY UNIQUE,
"revoked" bool NOT NULL DEFAULT 0
);
CREATE TABLE "securesync_facility" (
"signed_version" integer NOT NULL,
"name" varchar(100) NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"longitude" real, "zoom" real,
"signed_by_id" varchar(32),
"address_normalized" varchar(400) NOT NULL,
"user_count" integer NULL,
"contact_email" varchar(60) NOT NULL DEFAULT '',
"signature" varchar(360) NOT NULL,
"latitude" real,
"contact_name" varchar(60) NOT NULL DEFAULT '',
"contact_phone" varchar(60) NOT NULL DEFAULT '',
"id" varchar(32) PRIMARY KEY UNIQUE,
"address" varchar(400) NOT NULL,
"description" text NOT NULL
);
CREATE TABLE "securesync_facilitygroup" (
"signed_version" integer NOT NULL,
"name" varchar(30) NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signed_by_id" varchar(32),
"facility_id" varchar(32) NOT NULL,
"signature" varchar(360) NOT NULL,
"id" varchar(32) PRIMARY KEY UNIQUE
);
CREATE TABLE "securesync_facilityuser" (
"username" varchar(30) NOT NULL,
"first_name" varchar(30) NOT NULL,
"signed_version" integer NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"password" varchar(128) NOT NULL,
"notes" text NOT NULL,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"is_teacher" bool NOT NULL DEFAULT 0,
"signed_by_id" varchar(32),
"facility_id" varchar(32) NOT NULL,
"last_name" varchar(60) NOT NULL,
"signature" varchar(360) NOT NULL,
"group_id" varchar(32),
"id" varchar(32) PRIMARY KEY UNIQUE
);
CREATE TABLE "securesync_importpurgatory" (
"timestamp" datetime NOT NULL,
"serialized_models" text NOT NULL,
"counter" integer NOT NULL,
"model_count" integer NOT NULL DEFAULT 0,
"exceptions" text NOT NULL,
"retry_attempts" integer NOT NULL,
"id" integer PRIMARY KEY
);
CREATE TABLE "securesync_registereddevicepublickey" (
"id" integer NOT NULL PRIMARY KEY,
"public_key" varchar(500) NOT NULL,
"zone_id" varchar(32) NOT NULL
);
CREATE TABLE "securesync_syncedlog" ("category" varchar(50) NOT NULL,
"signed_version" integer NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"value" varchar(250) NOT NULL,
"signed_by_id" varchar(32),
"signature" varchar(360) NOT NULL,
"data" text NOT NULL,
"id" varchar(32) PRIMARY KEY UNIQUE
);
CREATE TABLE "securesync_syncsession" (
"server_device_id" varchar(32),
"verified" bool NOT NULL,
"client_device_id" varchar(32) NOT NULL,
"client_nonce" varchar(32) PRIMARY KEY UNIQUE,
"client_os" varchar(200) NOT NULL DEFAULT '',
"models_uploaded" integer NOT NULL,
"timestamp" datetime NOT NULL,
"closed" bool NOT NULL,
"ip" varchar(50) NOT NULL,
"client_version" varchar(100) NOT NULL DEFAULT '',
"server_nonce" varchar(32) NOT NULL,
"models_downloaded" integer NOT NULL
);
CREATE TABLE "securesync_zone" (
"signed_version" integer NOT NULL,
"name" varchar(100) NOT NULL,
"deleted" bool NOT NULL DEFAULT 0,
"counter" integer NOT NULL,
"zone_fallback_id" varchar(32),
"signed_by_id" varchar(32),
"signature" varchar(360) NOT NULL,
"id" varchar(32) PRIMARY KEY UNIQUE,
"description" text NOT NULL
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment