-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More work on migration of annotations to the DB instead of ES.
Metas (likes, etc.), comments, editing of annotation, etc. mostly working at this point. No ES yet though as I want to work out the bugs in the DB side first.
- Loading branch information
Showing
16 changed files
with
1,115 additions
and
756 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
class DevController extends BaseController | ||
{ | ||
public function getTest() | ||
{ | ||
$input = array( | ||
'permissions' => array( | ||
'read' => array(), | ||
'update' => array(1), | ||
'delete' => array(1), | ||
'admin' => array(1) | ||
), | ||
'user' => array( | ||
'id' => 1, | ||
'email' => '[email protected]', | ||
'user_level' => 1, | ||
'name' => "John C" | ||
), | ||
'ranges' => array( | ||
array( | ||
'start' => '/div[2]/div[1]/p[2]', | ||
'startOffset' => 0, | ||
'end' => '/div[2]/div[1]/p[2]', | ||
'endOffset' => 127 | ||
) | ||
), | ||
'quote' => "This is the quote", | ||
'text' => "This is the comment text", | ||
'tags' => array('tacobell'), | ||
'uri' => '/docs/testing', | ||
'comments' => array( | ||
array( | ||
'id' => 1, | ||
'text' => 'This is the comment on the comment', | ||
'created' => "Wed, 05 Mar 2014 12:40:47 -0500", | ||
'updated' => "Wed, 05 Mar 2014 12:40:47 -0500", | ||
'user' => array( | ||
'id' => 2, | ||
'user_level' => 3, | ||
'email' => '[email protected]', | ||
'name' => "Joe B" | ||
) | ||
) | ||
), | ||
'doc' => 1, | ||
'created' => "Wed, 05 Mar 2014 12:40:47 -0500", | ||
'updated' => "Wed, 05 Mar 2014 12:40:47 -0500", | ||
'user_action' => null, | ||
'flags' => 1, | ||
'likes' => 0, | ||
'dislikes' => 0 | ||
); | ||
|
||
$annotation = Annotation::createFromAnnotatorArray($input); | ||
|
||
var_dump($annotation); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
app/database/migrations/2014_03_17_150518_alter_note_meta_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class AlterNoteMetaTable extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('note_meta', function($table) { | ||
$table->dropColumn('note_id'); | ||
$table->integer('annotation_id')->unsigned(); | ||
}); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
throw new Exception("Can't rollback this migration"); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
app/database/migrations/2014_03_17_152535_add_foreign_index_note_meta.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class AddForeignIndexNoteMeta extends Migration { | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('note_meta', function($table) { | ||
$table->foreign('annotation_id')->references('id')->on('annotations')->on_delete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('note_meta', function($table) { | ||
$table->dropIndex('note_meta_annotation_id_foreign'); | ||
}); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.