Skip to content

Commit 8045555

Browse files
committed
Adding database dir
1 parent e9b9e81 commit 8045555

File tree

6 files changed

+94
-4
lines changed

6 files changed

+94
-4
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
],
1515
"require": {
1616
"php": ">=5.3.0",
17-
"syntax/core": "*"
17+
"syntax/core": ">=2"
1818
},
1919
"autoload": {
2020
"classmap": [
2121
"src/controllers",
22+
"src/database/migrations",
23+
"src/database/seeds",
2224
"src/models",
2325
"src/node",
2426
"src/views"

src/Syntax/Chat/ChatServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php namespace Syntax\Core;
1+
<?php namespace Syntax\Chat;
22

33
use Illuminate\Support\ServiceProvider;
44

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateChatsTable extends Migration {
7+
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('chats', function(Blueprint $table) {
16+
$table->increments('id');
17+
$table->string('chat_room_id', 10)->index();
18+
$table->string('user_id', 10)->index();
19+
$table->string('character_id', 10)->index()->nullable();
20+
$table->text('message');
21+
$table->timestamps();
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::drop('chats');
33+
}
34+
35+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateChatRoomsTable extends Migration {
7+
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('chat_rooms', function(Blueprint $table) {
16+
$table->string('uniqueId', 10);
17+
$table->primary('uniqueId');
18+
$table->string('user_id', 10)->index();
19+
$table->string('game_id', 10)->index()->nullable();
20+
$table->text('name');
21+
$table->boolean('activeFlag')->default(1);
22+
$table->timestamps();
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
Schema::drop('chat_rooms');
34+
}
35+
36+
}

src/database/seeds/DatabaseSeeder.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
class DatabaseSeeder extends Seeder {
4+
5+
/**
6+
* Run the database seeds.
7+
*
8+
* @return void
9+
*/
10+
public function run()
11+
{
12+
Eloquent::unguard();
13+
14+
}
15+
16+
}

src/node/chat.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ var fs = require("fs");
55
var io = require("socket.io");
66
var httpsync = require("httpsync");
77
var path = require('path');
8-
var configDir = '../config/packages/syntax/core/';
9-
var log = fs.createWriteStream('../storage/logs/node.txt', {'flags': 'a'});
8+
var configDir = '../../../../../app/config/packages/syntax/chat/';
9+
// var log = fs.createWriteStream('../storage/logs/node.txt', {'flags': 'a'});
1010

1111
/**
1212
* Configure the application
1313
*/
1414
try {
15+
// console.log(path.resolve(__dirname, configDir, 'chatConfig.json'));
1516
if (!fs.existsSync(path.resolve(__dirname, configDir, 'chatConfig.json'))) {
1617
throw "Configuration file does not exist.";
1718
}

0 commit comments

Comments
 (0)