Skip to content

Commit

Permalink
Merge pull request #126 from salopensource/BigAutoField
Browse files Browse the repository at this point in the history
Use big int for ids
  • Loading branch information
grahamgilbert authored Jul 5, 2017
2 parents e8ca2a7 + f9d11df commit ddb5599
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sal/version.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>version</key>
<string>3.2.0.949</string>
<string>3.2.1.950</string>
</dict>
</plist>
25 changes: 25 additions & 0 deletions server/migrations/0053_auto_20170705_1559.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-07-05 22:59
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('server', '0052_auto_20170624_0851'),
]

operations = [
migrations.AlterField(
model_name='condition',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='fact',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
]
60 changes: 60 additions & 0 deletions server/migrations/0054_auto_20170705_1603.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-07-05 23:03
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('server', '0053_auto_20170705_1559'),
]

operations = [
migrations.AlterField(
model_name='historicalfact',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='installedupdate',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='machine',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='pendingappleupdate',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='pendingupdate',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='pluginscriptrow',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='pluginscriptsubmission',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='updatehistory',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='updatehistoryitem',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
]
11 changes: 11 additions & 0 deletions server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Machine(models.Model):
('Windows', 'Windows'),
('Linux', 'Linux'),
)
id = models.BigAutoField(primary_key=True)
machine_group = models.ForeignKey(MachineGroup)
serial = models.CharField(db_index=True, max_length=100, unique=True)
hostname = models.CharField(max_length=256, null=True, blank=True)
Expand Down Expand Up @@ -209,6 +210,7 @@ def save(self, *args, **kwargs):
super(Machine, self).save()

class UpdateHistory(models.Model):
id = models.BigAutoField(primary_key=True)
UPDATE_TYPE = (
('third_party', '3rd Party'),
('apple', 'Apple'),
Expand All @@ -225,6 +227,7 @@ class Meta:
unique_together = (("machine", "name", "version", "update_type"),)

class UpdateHistoryItem(models.Model):
id = models.BigAutoField(primary_key=True)
UPDATE_STATUS = (
('pending', 'Pending'),
('error', 'Error'),
Expand All @@ -244,6 +247,7 @@ class Meta:


class Fact(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='facts')
fact_name = models.TextField(db_index=True)
fact_data = models.TextField()
Expand All @@ -253,6 +257,7 @@ class Meta:
ordering = ['fact_name']

class HistoricalFact(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='historical_facts')
fact_name = models.CharField(db_index=True, max_length=255)
fact_data = models.TextField()
Expand All @@ -263,6 +268,7 @@ class Meta:
ordering = ['fact_name', 'fact_recorded']

class Condition(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='conditions')
condition_name = models.CharField(max_length=255,db_index=True)
condition_data = models.TextField(db_index=True)
Expand All @@ -272,6 +278,7 @@ class Meta:
ordering = ['condition_name']

class PluginScriptSubmission(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine)
plugin = models.CharField(db_index=True, max_length=255)
historical = models.BooleanField(default=False)
Expand All @@ -282,6 +289,7 @@ class Meta:
ordering = ['recorded', 'plugin']

class PluginScriptRow(models.Model):
id = models.BigAutoField(primary_key=True)
submission = models.ForeignKey(PluginScriptSubmission)
pluginscript_name = models.TextField(db_index=True)
pluginscript_data = models.TextField(blank=True, null=True, db_index=True)
Expand Down Expand Up @@ -324,6 +332,7 @@ class Meta:
ordering = ['pluginscript_name']

class PendingUpdate(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='pending_updates')
update = models.CharField(db_index=True, max_length=255, null=True, blank=True)
update_version = models.CharField(db_index=True, max_length=255, null=True, blank=True)
Expand All @@ -334,6 +343,7 @@ class Meta:
ordering = ['display_name']

class InstalledUpdate(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='installed_updates')
update = models.CharField(db_index=True, max_length=255, null=True, blank=True)
update_version = models.CharField(db_index=True, max_length=255, null=True, blank=True)
Expand All @@ -346,6 +356,7 @@ class Meta:
unique_together = ("machine", "update", "update_version")

class PendingAppleUpdate(models.Model):
id = models.BigAutoField(primary_key=True)
machine = models.ForeignKey(Machine, related_name='pending_apple_updates')
update = models.CharField(db_index=True, max_length=255, null=True, blank=True)
update_version = models.CharField(db_index=True, max_length=256, null=True, blank=True)
Expand Down
2 changes: 1 addition & 1 deletion set_build_no.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

current_version="3.2.0"
current_version="3.2.1"
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd`

Expand Down

0 comments on commit ddb5599

Please sign in to comment.