Advertisement
moonlightcheese

dbschemaex

Jul 6th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.71 KB | None | 0 0
  1. package com.conceptualsystems.kitmobile;
  2.  
  3. import android.provider.BaseColumns;
  4.  
  5. ///////////////////////////////////
  6. //  CHANGELOG
  7. //  =============================
  8. //  6/24/11 - v2
  9. //  - added SiteSchema Table
  10. //  - added CustomerSchema Table
  11. //  - added ProductSchema Table
  12.  
  13. public final class DbSchema {
  14.     public static final String DATABASE_NAME = "smskitting";
  15.     public static final int DATABASE_VERSION = 2;
  16.     public static final String SORT_ASC = " ASC";
  17.     public static final String SORT_DESC = " DESC";
  18.     public static final String[] ORDERS = {SORT_ASC,SORT_DESC};
  19.     public static final int OFF = 0;
  20.     public static final int ON = 1;
  21.    
  22.     public static final class KitSchema implements BaseColumns {
  23.         public static final String TABLE_NAME = "kit";
  24.         public static final String COLUMN_ID = "kit_id";
  25.         public static final String COLUMN_RAW_ID = "raw_id";
  26.         public static final String COLUMN_FIN_ID = "fin_id";
  27.         public static final String COLUMN_DATE = "date";
  28.         public static final String COLUMN_GROSS = "gross";
  29.         public static final String COLUMN_NET = "net";
  30.         public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
  31.                 _ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
  32.                 COLUMN_ID + " TEXT NOT NULL," +
  33.                 COLUMN_RAW_ID + " INTEGER," +
  34.                 COLUMN_FIN_ID + " INTEGER NOT NULL," +
  35.                 COLUMN_DATE + " LONG NOT NULL," +
  36.                 COLUMN_GROSS + " INTEGER NOT NULL," +
  37.                 COLUMN_NET + " INTEGER NOT NULL);";
  38.         public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
  39.     }
  40.    
  41.     public static final class ShipmentSchema implements BaseColumns {
  42.         public static final String TABLE_NAME = "shipment";
  43.         public static final String COLUMN_ID = "kit_id";
  44.         public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
  45.                 _ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
  46.                 COLUMN_ID + " TEXT NOT NULL);";
  47.         public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
  48.     }
  49.    
  50.     public static final class SiteSchema implements BaseColumns {
  51.         public static final String TABLE_NAME = "site";
  52.         public static final String COLUMN_LABEL = "label";
  53.         public static final String COLUMN_IP = "ip";
  54.         public static final String COLUMN_PORT = "port";
  55.         public static final String COLUMN_ACTIVATION_CODE = "code";
  56.         public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
  57.                 _ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
  58.                 COLUMN_LABEL + " TEXT NOT NULL," +
  59.                 COLUMN_IP + " TEXT NOT NULL," +
  60.                 COLUMN_ACTIVATION_CODE + " TEXT," +
  61.                 COLUMN_PORT + " TEXT NOT NULL);";
  62.         public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
  63.     }
  64.    
  65.     public static final class CustomerSchema implements BaseColumns {
  66.         public static final String TABLE_NAME = "customers";
  67.         public static final String COLUMN_NAME = "name";
  68.         public static final String COLUMN_ID = "cust_id";
  69.         public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
  70.                 _ID + " INTEGER NOT NULL," +
  71.                 COLUMN_ID + " TEXT NOT NULL," +
  72.                 COLUMN_NAME + " TEXT NOT NULL);";
  73.         public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
  74.     }
  75.    
  76.     public static final class ProductSchema implements BaseColumns {
  77.         public static final String TABLE_NAME = "products";
  78.         public static final String COLUMN_NAME = "name";
  79.         public static final String COLUMN_ID = "prod_id";
  80.         public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" +
  81.                 _ID + " INTEGER NOT NULL," +
  82.                 COLUMN_ID + " TEXT NOT NULL," +
  83.                 COLUMN_NAME + " TEXT NOT NULL);";
  84.         public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement