/*
 * Copyright 2015, Yahoo Inc.
 * Copyrights licensed under the Apache 2.0 License.
 * See the accompanying LICENSE file for terms.
 */
package com.yahoo.squidb.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

/**
 * Used to specify that a field in a model spec should be used as the primary key for the table. This annotation
 * is only relevant for table models, i.e. models using {@link TableModelSpec}. At this time, only a single primary
 * key of type long is supported. You can use this annotation in combination with {@link ColumnSpec} to customize
 * your primary key column, including giving it a custom column name or specifying whether or not the column
 * should autoincrement (using {@link ColumnSpec#constraints()}.
 * <p>
 * If a PrimaryKey annotation is not present in a TableModelSpec class, a default ID property for the table will
 * automatically be generated.
 */
@Target(ElementType.FIELD)
public @interface PrimaryKey {

    /**
     * @return true if AUTOINCREMENT behavior for the primary key should be used. Defaults to true
     */
    boolean autoincrement() default true;

}

@@ -449,34 +449,15 @@
 c%7D. 
-At this time, only a singl
+Only on
 e pr
@@ -465,295 +465,508 @@
 mary
-%0A *
  key 
-of type long is supported. You can use this annotation in combination with %7B@link ColumnSpec%7D to customize%0A * your primary key
+per table is%0A * permitted by SQLite.%0A * %3Cp%3E%0A * Integer-type columns (long, int, etc.) that are annotated with the PrimaryKey annotation are considered%0A * %22INTEGER PRIMARY KEY%22 columns. In SQLite, an INTEGER PRIMARY KEY
  column
-,
  i
-ncluding giving it a custom column name or specifying whether or not the column%0A * should autoincrement (using %7B@link ColumnSpec#constraints()%7D
+s an alias for the built-in SQLite rowid%0A * column. If present, SquiDB will use such a column for model bookkeeping. If a non-integer column is annotated with%0A * PrimaryKey, SquiDB will generate an explicit reference to the built-in rowid column to use for bookkeeping
 .%0A *
@@ -1052,16 +1052,36 @@
 default 
+INTEGER PRIMARY KEY 
 ID prope
@@ -1083,24 +1083,27 @@
 property for
+%0A *
  the table w
@@ -1105,19 +1105,16 @@
 ble will
-%0A *
  automat
@@ -1133,16 +1133,171 @@
 nerated.
+ However, this behavior will be removed in a future version, in favor%0A * of using the built-in rowid column directly when no other primary key is declared.
 %0A */%0A@Ta
@@ -1458,16 +1458,82 @@
  to true
+. Applies only to%0A     * columns of integer type (long, int, etc.)
 %0A     */

Update outdated PrimaryKey annotation documentation